﻿using ConsoleApplication1.Config;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
   public class TestDbContext:DbContext
    {
        public TestDbContext():base("name=sql")//跟配置文件联系起来
        {

        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //modelBuilder.Configurations.Add(new TestConfiger());
            //加载所有的映射关系类
            modelBuilder.Configurations.AddFromAssembly(Assembly.GetExecutingAssembly());
        }
            
        public DbSet<Test> Tests { get; set; }
    }
}
